package cn.le.config;

import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * 项目名  spring-boot
 * Created by lansp
 * Created at 2018/6/5
 * 描述:
 */
@Component
@Validated
public class MongoSettingsProperties {

	@NotBlank
	private String database;
	@NotEmpty
	private List<String> hosts;
	@NotEmpty
	private List<Integer> ports;

	private String replicaSet;
	private String userName;
	private String password;
	private String authenticationDatabase;
	private Integer minConnectionPerHost = 10; //客户端最小连接数
	private Integer connectionPerHost = 2; //客户端连接数

	public String getDatabase() {
		return database;
	}

	public void setDatabase(String database) {
		this.database = database;
	}

	public List<String> getHosts() {
		return hosts;
	}

	public void setHosts(List<String> hosts) {
		this.hosts = hosts;
	}

	public List<Integer> getPorts() {
		return ports;
	}

	public void setPorts(List<Integer> ports) {
		this.ports = ports;
	}

	public String getReplicaSet() {
		return replicaSet;
	}

	public void setReplicaSet(String replicaSet) {
		this.replicaSet = replicaSet;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAuthenticationDatabase() {
		return authenticationDatabase;
	}

	public void setAuthenticationDatabase(String authenticationDatabase) {
		this.authenticationDatabase = authenticationDatabase;
	}

	public Integer getMinConnectionPerHost() {
		return minConnectionPerHost;
	}

	public void setMinConnectionPerHost(Integer minConnectionPerHost) {
		this.minConnectionPerHost = minConnectionPerHost;
	}

	public Integer getConnectionPerHost() {
		return connectionPerHost;
	}

	public void setConnectionPerHost(Integer connectionPerHost) {
		this.connectionPerHost = connectionPerHost;
	}
}
